import $web3js from "../web3.js";

const ifilNftTradeContract = require("./ifilNftTradeContract.json");

let contractAddress = "";
let web3 = $web3js.getWeb3();
let contractConst = {
  contract: web3
    ? new web3.eth.Contract(ifilNftTradeContract.abi, contractAddress)
    : ""
};
const getIfilNftTradeAddress = () => {
  return contractAddress;
};

const getIfilNftTradeContract = () => {
  return contractConst.contract;
};

const getIfilNftTradeName = () => {
  return contractName;
};

const getIfilNftTradeVersion = () => {
  return contractVersion;
};

const getIfilNftTradeSalt = () => {
  return contractSalt;
};

const tradeNFT = makerData => {
  return $web3js.commonSend(
    getIfilNftTradeContract().methods.tradeNFT,
    makerData
  );
};

const tradeNFTEstimateGas = makerData => {
  return $web3js.commonEstimateGas(
    getIfilNftTradeContract().methods.tradeNFT,
    makerData
  );
};

export default {
  getIfilNftTradeAddress,
  getIfilNftTradeContract,
  getIfilNftTradeName,
  getIfilNftTradeVersion,
  getIfilNftTradeSalt,
  tradeNFT,
  tradeNFTEstimateGas
};
